# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: Andrea Scarpino <andrea@archlinux.org>
# Contributor: Jaroslav Lichtblau <dragonlord@aur.archlinux.org>
# Contributor: Ionut Biru <ibiru@archlinux.org>
# Contributor: Joeny Ang <ang(dot)joeny(at)gmail(dot)com>
# Contributor: Brad Fanella <bradfanella@archlinux.us>

pkgname=libraw
pkgver=0.21.1
pkgrel=2
pkgdesc='A library for reading RAW files obtained from digital photo cameras (CRW/CR2, NEF, RAF, DNG, and others)'
arch=(loong64 x86_64)
url='https://www.libraw.org/'
license=(CDDL LGPL)
depends=(lcms2 jasper)
source=(https://www.libraw.org/data/LibRaw-$pkgver.tar.gz
        https://github.com/LibRaw/LibRaw/commit/477e0719ff.patch)
sha256sums=('630a6bcf5e65d1b1b40cdb8608bdb922316759bfb981c65091fec8682d1543cd'
            '49469accec0d6f0fbfafb7083a440545bce0e87bcbdee3427ba8671b54ee13d7')

prepare() {
  cd LibRaw-$pkgver
  # CVE-2023-1729
  patch -Np1 -i ../477e0719ff.patch
}

build() {
  cd LibRaw-$pkgver
  autoreconf
  ./configure --prefix=/usr
  make
}

package() {
  cd LibRaw-$pkgver
  make DESTDIR="$pkgdir" install
}
